package com.zmn.plat.common.dictionary;

/**
 * 基础城市系数类型枚举
 *
 * @author linfeng
 * @since 2020/06/15 14:56:30
 */
public enum BaseCityRatioTypeEnum {

    /**
     * values
     */
    CITYRATIO(102, "城市默认系数"),
    CITYCATEGONERATIO(104, "产品一级分类系数"),
    CITYCATEGTWORATIO(105, "产品二级分类系数"),
    CITYMETER3RATIO(106, "计价器3.0系数"),
    ;

    private Integer code;
    private String name;

    BaseCityRatioTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static BaseCityRatioTypeEnum of(Integer code) {
        if (code == null || code == 0) {
            return CITYRATIO;
        }
        switch (code) {
            case 102:
                return CITYRATIO;
            case 104:
                return CITYCATEGONERATIO;
            case 105:
                return CITYCATEGTWORATIO;
            default:
                return CITYRATIO;
        }
    }
}
